package com.lekang.service.impl;

import java.util.Date;
import java.util.List;
import com.lekang.common.utils.DateUtils;
import com.lekang.common.utils.SecurityUtils;
import org.activiti.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lekang.mapper.AccraditationRecordMapper;
import com.lekang.domain.AccraditationRecord;
import com.lekang.service.IAccraditationRecordService;

/**
 * 审批记录Service业务层处理
 * 
 * @author wjy
 * @date 2025-10-17
 */
@Service
public class AccraditationRecordServiceImpl implements IAccraditationRecordService 
{
    @Autowired
    private AccraditationRecordMapper accraditationRecordMapper;
    @Override
    public AccraditationRecord selectByStepNoAndCheckContentId(Integer stepNo, Long checkContentId) {
        // 直接调用Mapper层的精准查询方法
        return accraditationRecordMapper.selectByStepNoAndCheckContentId(stepNo, checkContentId);
    }
    /**
     * 查询审批记录
     * 
     * @param id 审批记录主键
     * @return 审批记录
     */
    @Override
    public AccraditationRecord selectAccraditationRecordById(Long id)
    {
        return accraditationRecordMapper.selectAccraditationRecordById(id);
    }


    /**
     * 查询审批记录列表
     * 
     * @param accraditationRecord 审批记录
     * @return 审批记录
     */
    @Override
    public List<AccraditationRecord> selectAccraditationRecordList(AccraditationRecord accraditationRecord)
    {
        return accraditationRecordMapper.selectAccraditationRecordList(accraditationRecord);
    }
    /**
     * 查询审批记录列表
     *
     * @param accraditationRecord 审批记录
     * @return 审批记录
     */
    @Override
    public List<AccraditationRecord> selectAccraditationRecordList1(AccraditationRecord accraditationRecord)
    {
        return accraditationRecordMapper.selectAccraditationRecordList1(accraditationRecord);
    }

    /**
     * 新增审批记录
     * 
     * @param accraditationRecord 审批记录
     * @return 结果
     */
    @Override
    public int insertAccraditationRecord(AccraditationRecord accraditationRecord)
    {
//        审批--同意 拒绝

        accraditationRecord.setCreateTime(DateUtils.getNowDate());
        int i = accraditationRecordMapper.insertAccraditationRecord(accraditationRecord);
        return i;
    }

    /**
     * 修改审批记录
     *
     * @param accraditationRecord 审批记录
     * @return 结果
     */
    @Override
    public int updateAccraditationRecord(AccraditationRecord accraditationRecord)
    {
        accraditationRecord.setUpdateTime(DateUtils.getNowDate());
        return accraditationRecordMapper.updateAccraditationRecord(accraditationRecord);
    }

    /**
     * 批量删除审批记录
     * 
     * @param ids 需要删除的审批记录主键
     * @return 结果
     */
    @Override
    public int deleteAccraditationRecordByIds(Long[] ids)
    {
        return accraditationRecordMapper.deleteAccraditationRecordByIds(ids);
    }

    /**
     * 删除审批记录信息
     * 
     * @param id 审批记录主键
     * @return 结果
     */
    @Override
    public int deleteAccraditationRecordById(Long id)
    {
        return accraditationRecordMapper.deleteAccraditationRecordById(id);
    }

    @Override
    public AccraditationRecord selectByDropContentId(String dropContentId) {
        return accraditationRecordMapper.selectByDropContentId(dropContentId);
    }

    @Override
    public int deleteAccraditationRecordByCheckContentId(Long checkContentId) {
        return accraditationRecordMapper.deleteAccraditationRecordByCheckContentId(checkContentId);
    }
}
